* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    position: relative;
    height: 100%;
    background-color: #F2F4F5;
    overflow: hidden;
    transition: background-color .5s;
}

main {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

iframe {
    border: 0;
}

/* toc */
.toc-side {
    position: absolute;
    left: -300px;
    top: 0;
    width: 300px;
    height: 100%;
    background-color: #fff;
    overflow: auto;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);
}

.with-animation .toc-side {
    transition: left .3s;
}

.toc-on .toc-side {
    left: 0;
}

.toc-side::-webkit-scrollbar { /* 滚动条 */
    width: 8px;
}

.toc-side::-webkit-scrollbar-button { /* 滚动条两端的按钮 */
    display: none;
}

.toc-side::-webkit-scrollbar-track { /* 外层轨道 */
    background-color: #c7c9ca;
}

.toc-side::-webkit-scrollbar-thumb { /* 滚动块 */
    background-color: #726E6B;
    border-radius: 8px;
}

.toc {
    height: 100.1%; /* 展示滚动条 */
}

.toc-head {
    position: relative;
    width: 100%;
    padding: 20px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.25rem;
    border-bottom: 1px dashed #000;
}

.chapter-list {
    padding-left: 10%;
    overflow: hidden;
    transition: .3s;
}

.chapter-list.collapse {
    /* 高度由js控制 */
}

.chapter-list.expand {
    /* 高度由js控制 */
}

.chapter-list-item {
    min-height: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    cursor: pointer;
    position: relative;
}

.chapter-list-item:not(:last-child):before {
    content: '';
    display: block;
    position: absolute;
    left: 8px;
    height: 100%;
    width: 2px;
    background-color: #726E6B;
}

.item-content {
    display: flex;
}

.item-mark {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    margin-right: 1em;
    background: #e0e0e0;
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);
    flex-shrink: 0; /* 空间不足时不缩小 */
    transition: .3s;
}

.item-mark:after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    right: -100%;
    width: 100%;
    height: 2px;
    background-color: #726E6B;
}

.item-mark:before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 17px;
    height: 17px;
    transition: transform .3s;
}

.item-mark.expand:before {
    background: url("../../img/collapse.png") center no-repeat;
    transform: rotate(90deg);
}

.item-mark.collapse:before {
    background: url("../../img/collapse.png") center no-repeat;
    transform: rotate(0);
}

.item-mark:hover {
    border-color: #F5C28A;
}

.chapter-url {
    font-size: .875rem;
    transition: none;
}

.chapter-url:active {
    color: #f58f48;
}

/* 右侧 */
.main {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}

.with-animation .main {
    transition: left .3s;
}

.toc-on .main {
    left: 300px;
}

.page {
    position: absolute;
    left: 80px;
    right: 80px;
    top: 0;
    bottom: 0;
    margin: auto;
}

.page.doc {
    left: 0;
    right: 0;
}

.page.hide {
    display: none;
}

.prev-page, .next-page {
    position: absolute;
    display: flex;
    width: 80px;
    height: 30%;
    font-size: 30px;
    cursor: pointer;
    opacity: 0;
    transition: .5s;
}

.prev-page:hover, .next-page:hover {
    opacity: 1;
}

.prev-page {
    left: 0;
    top: 50%;
    background: url("../../img/left-arrow.png") no-repeat center;
    transform: translateY(-50%);
}

.next-page {
    right: 0;
    top: 50%;
    background: url("../../img/right-arrow.png") no-repeat center;
    transform: translateY(-50%);
}

/* svg toc-button */

.toc-button {
    position: absolute;
    top: 20px;
    left: 20px;
    cursor: pointer;
    z-index: 10;
}

/* 重置 modal 的背景色 */
.modal {
    background-color: #e3e3e3;
}

/* 重置 modal 的关闭按钮 */
.modal-close {
    border: 1px solid #444;
}

/* tool-bar */
.tool-bar {
    position: absolute;
    right: 0; /* todo 位置应与样式分离 */
    bottom: 40px;
    width: 300px; /* todo 未指定width的bug*/
    height: 40px;
    padding: 0 10px;
    border-radius: 4px;
    cursor: url("../../img/cursor-move.png"), auto;
    font-size: 0; /* hack: 去除inline-block间的空格 */
    background: #ECE9E6; /* fallback for old browsers */
    background: -webkit-linear-gradient(to bottom, #FFFFFF, #ECE9E6); /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to bottom, #FFFFFF, #ECE9E6); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    box-shadow: 0 3px 15px 1px rgba(0, 0, 0, .2);
    transition: opacity .5s, transform .5s;
}

.drag-me {
    cursor: url("../../img/cursor-move.png"), auto;
}

.tool-bar-btn {
    display: inline-block;
    height: inherit;
    width: 40px;
    padding-left: 8px;
    padding-right: 8px;
}

.tool-bar-btn:not(.drag-me):hover {
    background-color: rgba(0, 0, 0, .15);
}

/* color-panel */
#color-panel .modal-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.color-picker canvas {
    cursor: crosshair;
}

.color-row {
    display: flex;
    margin: 20px;
}

.color-list {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 195px;
    height: 55px;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    transition: .3s;
}

.color-list:hover {
    box-shadow: 0 0.5em 1.5em rgba(0,0,0,.15);
}

.color-item {
    width: 25px;
    height: 25px;
    border: 1px solid transparent;
    border-radius: 5px;
    transition: .3s;
}

.color-item.selected {
    border-color: #f5c18a;
}

.color-item:hover {
    border-color: #f5c18a;
}

.background .color-item:nth-child(1) {
    background-color: #f6ebd0;
}

.background .color-item:nth-child(2) {
    background-color: #f1f3f4;
}

.background .color-item:nth-child(3) {
    background-color: #f7f6f2;
}

.background .color-item:nth-child(4) {
    background-color: #666;
}

.background .color-item:nth-child(5) {
    background-color: #3a4;
}

.font .color-item:nth-child(1) {
    background-color: #000;
}

.font .color-item:nth-child(2) {
    background-color: #444;
}

.font .color-item:nth-child(3) {
    background-color: #d3d3d3;
}

.font .color-item:nth-child(4) {
    background-color: #e5e5e5;
}

.font .color-item:nth-child(5) {
    background-color: #3a4;
}

/* setting panel */

.tabs {
    width: 45%;
    height: 40px;
}

.tab-panel {
    text-align: center;
}

.tab-panel {
    padding: 30px 0 10px;
}

.font-size-control {
    height: 32px;
    width: 30%;
    margin: auto;
    display: flex;
    justify-content: space-between;
}

.font-size-control span {
    line-height: 32px;
}

.font-size-control button {
    padding: .25em;
}

.page-control {
    width: 40%;
    margin: auto;
    display: flex;
    justify-content: space-around;
}

.other-control {
    width: 60%;
    margin: auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.page-control i {
    width: 24px;
    height: 24px;
}

.style-control {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 50px;
    width: 40%;
    margin: auto;
}

.letter-spacing-box {
    position: relative;
}

.spacing-control > div {
    width: 60%;
    margin: auto;
    justify-content: space-around;
    display: flex;
}

.spacing-info {
    width: 55%;
}

.ctrl-btns {
    width: 40%;
}

.ctrl-btns button {
    padding: .25em;
    display: table-cell;
}

.ctrl-btns i {
    vertical-align: middle;
}

.second-msg {
    font-size: 14px;
    color: gray;
}

.font-size, .line-height, .letter-spacing, .word-spacing {
    font-size: 14px;
}

.stylesheet, .restore {
    position: relative;
    width: 55px;
    height: 35px;
    color: #4d4d4d;
    border-radius: 5px;
    background-color: rgba(200, 200, 200, .5);
    cursor: pointer;
    transition: background-color .3s;
}

.stylesheet:hover, .restore:hover {
    background-color: #c8c8c8;
}

.stylesheet i, .restore i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.style-info {
    margin-top: 20px;
}

.style-info a {
    color: #8A6BBE;
    text-decoration: none;
}

.style-info a:hover {
    color: #7b5b96;
    text-decoration: underline;
}

.other-row {
    width: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.other-row > span.second-msg {
    text-align: left;
    width: 70%;
}

.other-row > .ctrl-btns {
    text-align: right;
    width: 30%;
}

/* 书签栏 */
.book-mark-panel {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    background-color: #fff;
    box-shadow: 2px 0 3px 0 rgba(0, 0, 0, .15);
    z-index: 999;
    transition: transform .3s;
}

.book-mark-overlay {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    display: block;
    width: 100vw;
    height: 100vh;
    visibility: visible;
    opacity: .3;
    background-color: #000;
    z-index: 998;
    transition: .3s;
}

.book-mark-panel.hide {
    transform: translateX(-100%);
}

.book-mark-panel.hide + .book-mark-overlay {
    visibility: hidden;
    opacity: 0;
}

.book-mark-head {
    text-align: center;
    margin: 20px auto;
    font-size: 18px;
}

.book-mark-item {
    margin-bottom: 10px;
    border-bottom: 1px solid #dddddd;
    padding: 0 10px;
}

.book-mark-cfi {
    height: inherit;
    width: 210px;
    cursor: pointer;
    word-wrap: break-word;
}

.book-mark-cfi a {
    transition: none;;
}

.book-mark-cfi a:active {
    color: #f58f48;
}

.book-mark-control {
    height: inherit;
    width: 64px;
    cursor: pointer;
}

.book-mark-panel i {
    padding-left: 5px;
    cursor: pointer;
    transition: color .3s;
}

.book-mark-panel i:hover {
    color: #f5c18a;
}

.book-mark-panel-close {
    position: absolute;
    right: 20px;
}

/* 选中菜单 */
.select-menu {
    position: absolute;
    visibility: hidden;
    width: 200px;
    padding: 10px 0;
    background-color: #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
    border: 1px solid rgba(27, 31, 35, 0.15);
    border-radius: 4px;
    z-index: 10;
}

.menu-item {
    padding: 4px 15px;
    cursor: pointer;
    transition: background-color .3s;
}

.menu-item:hover {
    background-color: rgba(220, 220, 220, .4);
}

.ann-color-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.select-menu .divider {
    margin: 10px 0;
}

.ann-color {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform .3s;
}

.ann-color:hover {
    transform: scale(1.2, 1.2);
}

.ann-underline-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.ann-underline {
    display: inline-block;
    width: 22px;
    height: 22px;
    cursor: pointer;
    transition: transform .3s;
}

.ann-underline:hover {
    transform: scale(1.2, 1.2);
}